package com.maoning.auth.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

/**
 * @Author : 猫宁
 * @Date: 2022/3/31
 */
@Controller
public class IndexController {

//    配置了视图映射就可以避免写那种空的controller了
    @GetMapping({"login.html"})
    public String loginPage(Model model, HttpSession session) {
        final Object loginUser = session.getAttribute("loginUser");
        if(loginUser != null){
            return "redirect:http://gulimall.com";
        }else {

            return "login";
        }
    }

    @GetMapping({"reg.html"})
    public String regPage(Model model) {

        return "reg";
    }



}
